// components/w-tab-control/w-tab-control.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    list: {
      type: Array,
      value: []
    },
    offsetTop: {
      type: Number,
      value: 0
    },
    offsetLeft: {
      type: Number,
      value: 0
    },
    offsetRight: {
      type: Number,
      value: 0
    },
    isFixed: {
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    currentIndex: 0
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleItemClick(event) {
      let dataset = event.currentTarget.dataset;
      this.setData({
        currentIndex: dataset.index
      })
      this.triggerEvent("tabControlItemClick", {
        type: dataset.type
      });
    }
  }
})